<?php
class InforsController extends AppController {

	var $name = 'Infors';
		function beforeFilter() {

		parent::beforeFilter();

		$this->set('mod','infors','chitiet');
	}
	function index($id = null) {
		$this->layout = 'main';
 		if (!$id) {
			$this->Session->setFlash(__('Không có bản ghi này.', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->set('infors', $this->Infor->read(null, $id));
		//banner
		//$this->Banner->recursive = 1;
		//$banners = $this->Banner->find('all',array('fields'=>array('id', 'name', 'description', 'link', 'image'),'conditions' =>array('Location.code'=>'GUIDE'),'limit'=>1,'order'=>'order asc'));
		//$this->set(compact('banners'));
 	}
	function help() {
		$infors=$this->Infor->find('first',array('conditions'=>array('id'=>3)));
		$this->set(compact('infors'));
	}
	function admin_index($id = null) {
		if (!empty($this->data)) {
			if ($this->Infor->save($this->data)) {
				$this->Session->setFlash(__('Thông tin đã được lưu.', true));
				$this->redirect(array('action' => 'index',$id));
			} else {
				$this->redirect(array('action' => 'index',$id));
			}
		}
		if (empty($this->data)) {
			$this->data = $this->Infor->read(null, $id);
		}
		$this->set(compact('id'));
	}
}
?>